﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Ue.CQRS.Tests.Aop
{
    [TestClass]
    public class MethodDecoratorTests
    {
        [TestMethod]
        public void GetSender()
        {
            this.Tests();
        }

        [TestMethodAop]
        public void Tests()
        {
        }
    }

    public class TestMethodAopAttribute : System.Attribute, Ue.CQRS.Aop.IMethodDecorator
    {
        public void OnEntry(object sender, System.Reflection.MethodBase method)
        {
            Assert.AreEqual(typeof(MethodDecoratorTests), sender.GetType());
        }

        public void OnExit(object sender, System.Reflection.MethodBase method, object returnValue)
        {
            Assert.AreEqual(typeof(MethodDecoratorTests), sender.GetType());
        }

        public void OnException(object sender, System.Reflection.MethodBase method, Exception exception)
        {
            Assert.AreEqual(typeof(MethodDecoratorTests), sender.GetType());
        }
    }
}
